package profiler;

import java.io.IOException;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import dataStructures.ProfileWritable;

public class SplitOutputMapper extends Mapper<Text, ProfileWritable, Text, ProfileWritable> {

	@Override
	protected void map(Text key, ProfileWritable value, Context context) throws IOException, InterruptedException {
		Text outputKey = new Text();
		String prefix = key.toString().substring(0, 1);
		String prefixProperty = context.getConfiguration().get(ProfilingDriver.PREFIX_PROPERTY);
		if (prefix.equals(prefixProperty)) {
			outputKey.set(prefix);		
			context.write(outputKey, value);			
		}
	}
}
